var L, apiPre, appId, appMaster, headers, ms, requestSign;

appId = 'p4po2ekr5r78quspni4ryzhedfv952h3o18oacqahh7ie3k5';

appMaster = 'ks9nwtdabuc2kynkcxm6vtgpawfh0329rnrgm4owtwqywth7';

ms = new Date().getTime();

requestSign = md5(ms + appMaster);

apiPre = 'https://leancloud.cn/1.1/';

headers = {
  "Content-Type": "application/json",
  "X-AVOSCloud-Application-Id": appId,
  "X-AVOSCloud-Request-sign": requestSign + ',' + ms + ',master'
};

L = {
  sendSmsCode: function(mobilePhoneNumber) {
    return new Promise(function(resolve, reject) {
      return $.ajax({
        url: apiPre + 'requestSmsCode',
        type: 'post',
        headers: headers,
        data: {
          mobilePhoneNumber: mobilePhoneNumber
        }
      });
    });
  },
  signin: function(phone, password) {
    return new Promise(function(resolve, reject) {
      return $.ajax({
        url: apiPre + 'usersByMobilePhone',
        type: 'post',
        headers: headers,
        data: {
          "mobilePhoneNumber": "",
          "smsCode": ""
        }
      }).done(function(ret) {
        return resolve(ret);
      }).error(function(err) {
        return reject(err);
      });
    });
  }
};
